Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util/ranger: fix incorrect behavior about index who has prefix column #8851

Merged
merged 7 commits into from
Dec 29, 2018

Conversation

winoros
Copy link
Member

@winoros winoros commented Dec 27, 2018

What problem does this PR solve?

Previously, when one index has a prefix column, we'll convert an open interval to a closed one. e.g. col < aaaaaa and col > aaaaaa will become (-inf, aaa], [aaa, +inf)(if the prefix len is 3).
However when sending requests to tikv. We need to promise that the ranges need to be ordered and no intersection. In (-inf, aaa], [aaa, +inf), [aaa, aaa] is intersected in both interval, it will cause error arose when aaa is the exact the place that that data before and after it lies in different regions.

What is changed and how it works?

Enhance the check, only we'll change the interval only when the last index column is cut.
Do a range merging if a cut is performed.

Check List

Tests

  • Unit test

Side effects

  • Increased code complexity

Related changes

  • Need to cherry-pick to the release branch
  • Need to be included in the release note fix the range information built from index who has prefix column, it may cause tikv panic in a very rare situation

This change is Reviewable

@winoros
Copy link
Member Author

winoros commented Dec 27, 2018

/run-all-tests tikv=release-2.1 pd=release-2.1 tidb-test=release-2.1

@winoros winoros added type/bugfix This PR fixes a bug. sig/planner SIG: Planner labels Dec 28, 2018
@winoros winoros changed the title [DNM] for binary building util/ranger: fix incorrect behavior about index who has prefix column Dec 28, 2018
@zz-jason
Copy link
Member

LGTM

alivxxx
alivxxx previously approved these changes Dec 29, 2018
Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zz-jason zz-jason added the status/LGT2 Indicates that a PR has LGTM 2. label Dec 29, 2018
@alivxxx
Copy link
Contributor

alivxxx commented Dec 29, 2018

/run-all-tests tikv=release-2.1 pd=release-2.1 tidb-test=release-2.1

@zz-jason zz-jason added the priority/P1 The issue has P1 priority. label Dec 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/P1 The issue has P1 priority. sig/planner SIG: Planner status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants